<template>
	<u-navbar
		:bgColor="{
			'backgroundColor':'#6882f1'
		}"
		:title="title"
		title-color="#FFFFFF"
		title-size="32"
		:is-back="isBack"
		:back-icon-name="backIcon"
		back-icon-color="#FFFFFF"
		back-icon-size="32"
		:leftIcon="customBack"
		:radius="radius"
	/>
</template>

<script>
export default {
  props: {
    isBack: {
      type: Boolean,
      default: false
    },
    title: {
      type: String,
      default: 'CHANGE元电荷'
    },
    radius: {
      type: Boolean,
      default: true
    }
  },
  computed: {
    backIcon() {
      const pages = getCurrentPages()

      return pages.length > 1 ? 'home-fill' : 'home-fill'
    }
  },
  methods: {
    /**
     * 自定义返回回调
     */
    customBack() {
      /* 判断页面栈，如果只有一页则返回主页 */
      const pages = getCurrentPages()

      uni.navigateBack()

    }
  }
}
</script>
